package com.ai.bitcoin.jpa.service.impl;

import com.ai.bitcoin.jpa.dao.BccBasicInfoCrawlDao;
import com.ai.bitcoin.jpa.entity.BccBasicInfoCrawl;
import com.ai.bitcoin.jpa.service.BccBasicInfoCrawlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * @author Jason
 * @date 2018/2/4
 */
@Service
public class BccBasicInfoCrawServiceImpl implements BccBasicInfoCrawlService {
    @Autowired
    BccBasicInfoCrawlDao dao;

    @Override
    @Transactional
    public BccBasicInfoCrawl save(BccBasicInfoCrawl bccBasicInfoCrawl) {
        return dao.saveAndFlush(bccBasicInfoCrawl);
    }


    @Override
    public List<BccBasicInfoCrawl> findByBatchNo(String batchNo) {
        return dao.findByBatchNo(batchNo);
    }

    @Override
    public Page<BccBasicInfoCrawl> findByBatchNo(String batchNo, Pageable pageable) {
        return dao.findByBatchNo(batchNo, pageable);
    }

    @Override
    public List<BccBasicInfoCrawl> findByBccId(String bccId) {
        return dao.findByBccId(bccId);
    }

    @Override
    public List<BccBasicInfoCrawl> findByBccIdAndBatchNo(String bccId, String batchNo) {
        return dao.findByBccIdAndBatchNo(bccId, batchNo);
    }

    @Override
    @Transactional
    public void deleteByBatchNo(String batchNo) {
        dao.deleteByBatchNo(batchNo);
    }
}
